package com.sugar.psych.assessment.module.business.dal.dataobject.psychquestion;

import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.sugar.psych.assessment.module.business.other.OptionListTypeHandler;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;

import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;

import com.baomidou.mybatisplus.annotation.*;
import com.sugar.psych.assessment.framework.mybatis.core.dataobject.BaseDO;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * 心理测评题目 DO
 *
 * @author Ysugar
 */
@TableName(value = "business_psych_question", autoResultMap = true)
@KeySequence("business_psych_question_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库，可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class PsychQuestionDO extends BaseDO {

    /**
     * 主键
     */
    @TableId
    private Long id;
    /**
     * 题库编号
     */
    private Long bankId;
    /**
     * 题目
     */
    private String title;
    /**
     * 选项信息
     */
    @TableField(typeHandler = OptionListTypeHandler.class)
    private List<Option> optionList;
    /**
     * 题型（0单选 1多选）
     */
    private Boolean questionType;
    /**
     * 排序（从小到大）
     */
    private Integer sort;


    @Data
    public static class Option {

        @Schema(description = "选项标题（例如：A、B、C、D）")
        @NotBlank(message = "选项标题不能为空")
        private String selTitle;

        @Schema(description = "选项内容")
        @NotBlank(message = "选项内容不能为空")
        private String content;

        @Schema(description = "选项分值内容")
        @NotNull(message = "选项分值不能为空")
        private Integer score;
    }
}